package com.sf.fy.uav.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sf.fy.uav.common.response.order.PlaceOrderResponse;
import com.sf.fy.uav.common.utils.BeanUtil;
import com.sf.fy.uav.order.entity.PaySetting;
import com.sf.fy.uav.order.mapper.PaySettingMapper;
import com.sf.fy.uav.order.service.IPaySettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 支付参数保存 服务实现类
 * </p>
 *
 * @author LTQ
 * @since 2023-06-10
 */
@Service
public class PaySettingServiceImpl extends ServiceImpl<PaySettingMapper, PaySetting> implements IPaySettingService {

    @Autowired
    private PaySettingMapper paySettingMapper;

    @Override
    public PlaceOrderResponse getPaySettings(String orderId) {
        QueryWrapper<PaySetting> paySettingQueryWrapper = new QueryWrapper<>();
        paySettingQueryWrapper.eq("order_id", orderId);
        PaySetting paySetting = paySettingMapper.selectOne(paySettingQueryWrapper);
        return BeanUtil.copyProperties(paySetting, PlaceOrderResponse.class);
    }
}
